// Status.cs
//

namespace ServiceAdmin.Status
{
    using ServiceAdmin;
    using System;
	using System.Drawing;
    using System.ServiceProcess;


    /// <summary>
    /// Summary description for Status.
    /// </summary>
    public abstract class ServiceStatus
    {
        private		ServiceControllerStatus	_status				= ServiceControllerStatus.ContinuePending;
		protected	StatusCollection		_statusCollection	= null;


		public Icon StatusIcon
		{
			get
			{
				try
				{
					return new Icon(ImagePath);
				}
				catch
				{
					return null;
				}
			}
		}


        public abstract string ImagePath
        {
            get;
        }


		public abstract string StatusDescription
		{
			get;
		}


        public ServiceControllerStatus Status
        {
            get { return _status; }
        }


        /// <summary>
        /// Creates a new instance of Status
        /// </summary>
        public ServiceStatus(ServiceControllerStatus status, StatusCollection statusCollection)
        {
			_statusCollection	= statusCollection;
			_status				= status;
        }

		protected void UpdateTaskIcon()
		{
			_statusCollection.Handler.StartItem.Enabled = _statusCollection.Handler.StartButton.Enabled;
			_statusCollection.Handler.ResetItem.Enabled = _statusCollection.Handler.ResetButton.Enabled;
			_statusCollection.Handler.StopItem.Enabled = _statusCollection.Handler.StopButton.Enabled;
		}

		public abstract void OnActivate();
    }
}